﻿<%@ Page Title="" Language="C#" MasterPageFile="~/site.master" AutoEventWireup="true" CodeBehind="AllNotifications.aspx.cs" Inherits="CodeCamp12.AllNotifications" %>
<asp:Content ID="Content1" ContentPlaceHolderID="cphHead" runat="server">
    <script type="text/javascript">
        $(function() {
            $.ajax({
                type: 'POST',
                async: false,
                contentType: 'application/json; charset=utf-8',
                url: '../DataService.asmx/GetNotifications',
                dataType: 'json',
                success: function (msg) {
                    for (var i in msg.d) {
                        var announcements = [
                        { ID: msg.d[i].ID, Title: msg.d[i].Title, Date: JSONDate(msg.d[i].Date), Description: msg.d[i].Description, Link: msg.d[i].Link },
                    ];

                        $('#AnnouncementTemplate').tmpl(announcements).appendTo('#Announcements');
                    }
                }
            });

        });
    </script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="cphBody" runat="server">
    <div id="Announcements">
        <br />
        <h4>All announcements:</h4>
        <script id="AnnouncementTemplate" type="text/x-jQuery-tmpl">
            <div class='AnDiv'>
                <table>
                    <tr>
                        <a href='${Link}' class="title">${Title}</a>
                        <br />
                        <label style="font-size:x-small">[${Date}]</label>
                    
                    </tr>
                    <tr>
                         <br />
                         <br/>
                        {{html Description}}<a href='${Link}' class='more'>[More]</a>
                    </tr>
                </table>
            </div>
        </script>
   </div>
</asp:Content>
